<template>
	<view class="detail-view">
		<view class="top-bar"><uni-navbar :fixed="true" :back="true" color="#fff" title="新闻详情"></uni-navbar></view>

		<view class="detail-info">
			<view class="info-detail2">
				<view class="overflow"><uni-parse :content="showtext"></uni-parse></view>
			</view>
		</view>

		<view v-if="false && PUBURL"></view>
	</view>
</template>

<script>
import uniParse from '@/components/uni-parse/parse.vue';
import { mapState } from 'vuex';
export default {
	components: {
		uniParse
	},
	data() {
		return {
			showtext: '',
			PUBURL: '',
			play: false
		};
	},
	onLoad(option) {
		this.loadLogin();
		this.PUBURL = decodeURIComponent(option.PUBURL);
		this.loadData();
	},
	computed: {
		...mapState(['userInfo'])
	},
	methods: {
		loadLogin() {
			if (this.userInfo.Authorization) {
				this.clientCode = this.userInfo.sysUser.clientCode;
			} else {
				this.$logout();
			}
		},
		loadData() {
			let data = {
				clientCode: this.clientCode,
				url: this.PUBURL.toString()
			};
			this.$request('/webQ', data).then((res) => {
				let sprnstr = '<!--start component 文档组件\\(new\\)-->';
				let eprnstr = '<!--end component 文档组件\\(new\\)-->';
				let reg = new RegExp('<o:p>|</o:p>|<tr>|</tr>|<td>|</td>', 'g');
				let regex = new RegExp('<span[^>]*>|</span>|<font[^>]*>|</font>|<img[^>]*>', 'g');

				// let regex = new RegExp(sprnstr + '([\\s\\S]*?)' + eprnstr, 'i');
				let showhtml = res.data.match(/<table width="95%" align="center" border="0" cellspacing="0" cellpadding="0">([\s\S]*?)<\/table>/i);
				// let showhtml = res.data.match(regex);

				if (showhtml && showhtml[1]) {
					this.showtext = showhtml[1].replace(reg, '').replace(regex, '');
				}
			});
		}
	}
};
</script>

<style lang="scss">
.detail-view {
	background-color: #fff;
}

.fiexd-btm {
	position: static;
	border-top: 10upx solid $u-border-color;
	padding: 30upx;
}
</style>
